load("@npm//:typescript/package_json.bzl", tsc = "bin")
load("//tools:defaults.bzl", "copy_to_bin")

package(default_visibility = ["//packages/localize/tools/test/extract/integration:__pkg__"])

tsc.tsc(
    name = "compile_es5",
    srcs = glob(["src/*.ts"]),
    outs = [
        "dist_es5/index.js",
        "dist_es5/index.js.map",
    ],
    args = [
        "--target",
        "es5",
        "--module",
        "amd",
        "--outFile",
        "$(rootpath dist_es5/index.js)",
        "--skipLibCheck",
        "--sourceMap",
        "--inlineSources",
        "$(rootpath src/index.ts)",
    ],
)

tsc.tsc(
    name = "compile_es2015",
    srcs = glob(["src/*.ts"]),
    outs = [
        "dist_es2015/index.js",
        "dist_es2015/index.js.map",
    ],
    args = [
        "--target",
        "es2015",
        "--module",
        "amd",
        "--outFile",
        "$(rootpath dist_es2015/index.js)",
        "--skipLibCheck",
        "--sourceMap",
        "--inlineSources",
        "$(rootpath src/index.ts)",
    ],
)

# Use copy_to_bin since filegroup doesn't seem to work on Windows.
copy_to_bin(
    name = "test_files",
    srcs = glob([
        "**/*.js",
        "**/*.txt",
        "**/*.ts",
    ]),
)
